package com.dmooo.ymx.merchantadapter;



import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.media.ThumbnailUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.dmooo.ymx.R;
import com.dmooo.ymx.mallbean.MallCatbean;
import com.dmooo.ymx.merchantbean.Orderlistbean;

import java.util.List;

public class HorizontalListViewAdapter extends BaseAdapter{
    private Context mContext;
    private LayoutInflater mInflater;

    private Context context;
    private List<MallCatbean> lists;

    public HorizontalListViewAdapter(Context context, List<MallCatbean> list){
        this.mContext = context;
        this.lists = list;
        mInflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);//LayoutInflater.from(mContext);
    }
    @Override
    public int getCount() {
        return lists.size();
    }
    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder holder;
        if(convertView==null){
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.activity_myshop_horlistview, null);
            holder.mTitle=(TextView)convertView.findViewById(R.id.text_list_item);
            convertView.setTag(holder);
        }else{
            holder=(ViewHolder)convertView.getTag();
        }

        holder.mTitle.setText(lists.get(position).getCat_name());
        return convertView;
    }

    private static class ViewHolder {
        private TextView mTitle ;
    }
}
